import ReactDOM  from "react-dom/client";
/*
   声明变量
*/
let idcard="610122198404084030"
let name="Giles"
let age=38
let job="teacher"
let hobby=['play basketball','play football']
let avatar="https://www.baidu.com/img/flexible/logo/pc/result.png"
const getBirthday=idcard=>idcard.slice(6,10)+"-"+idcard.slice(10,12)+"-"+idcard.slice(12,14)
const template=(
    <>
        <h1>个人简介</h1>
        <div>姓名:{name}</div>
        <div>年龄:{age}</div>
        <div>工作:{job}</div>
        <div>爱好:{hobby}</div>
        <div>
            <img src={avatar}></img>
        </div>
        <div>是否成年:{age>=18?'成年':'未成年'}</div>
        <div>虚岁:{age+1}</div>
        <div>生日:{getBirthday(idcard)}</div>
    </>)
const root=ReactDOM.createRoot(document.querySelector('#root'))
root.render(template)